package com.ly.utils;

import lombok.Data;

import java.util.HashMap;
import java.util.Map;

@Data
public class ResposeData {
    private String mess;//错误信息
    private int code; //错误编码
    private Map<String,Object> data=new HashMap<>();  //保存json对象的
    //成功
    public static ResposeData ok(){
        ResposeData resposeData=new ResposeData();
        resposeData.code=200;
        resposeData.mess="成功";
        return resposeData;
    }
    //错误
    public static ResposeData error(){
        ResposeData resposeData=new ResposeData();
        resposeData.code=500;
        resposeData.mess="内部错误";
        return resposeData;
    }
    /**
     自定义错误
     */
    public static ResposeData currError(String mess){
        ResposeData resposeData=new ResposeData();
        resposeData.code=500;
        resposeData.mess=mess;
        return resposeData;
    }
    public  ResposeData put(String key,Object value){
        this.data.put(key,value);
        return this;
    }
}